package com.hotline.communication.enums;

import lombok.Getter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public enum BusinessTypeEnum {


    CONSULT(1,"咨询","ZX"),

    QUERY(2,"查询","CX"),

    COMPLAIN(3,"投诉","TS"),

    ILLEGAL_DISCIPLINARY_REPORT(4,"违法违纪举报","WFWJJB"),

    TAX_RELATED_REPORT(5,"涉税举报","SSJB"),

    SUGGESTION(6,"意见建议","YJJY"),

    CONSULT_QUERY(10,"咨询查询","ZXCX"),

    QUESTION_HANDLE(11,"问办结合","WBJH"),

    TAX_RELATED_SOFTWARE(12,"涉税软件问题","SSRJWT"),

    POLICY_ADVICE(13,"政策咨询","ZCZX"),

    PROCESS_CONSULTATION(14,"流程咨询","LCZX"),

    OPERATIONAL_CONSULTING(15,"操作咨询","CZZX"),

    APPEAL_RESPONSE(16,"诉求响应","SQXY");

//    ,OTHER(9,"其他");
    /**
     * 编码
     */
    @Getter
    private Integer code;

    /**
     * 名称
     */
    @Getter
    private String name;

    /**
     * 拼音
     */
    @Getter
    private String pinyin;


    BusinessTypeEnum(Integer code, String name, String pinyin) {
        this.code = code;
        this.name = name;
        this.pinyin = pinyin;
    }

    public static BusinessTypeEnum getBusinessTypeEnum(Integer code){
        for (BusinessTypeEnum businessTypeEnum : BusinessTypeEnum.values()){
            if(businessTypeEnum.getCode().equals(code)){
                return businessTypeEnum;
            }
        }
        return null;
    }

    public static List getBusinessTypeEnumList(){
        List list = new ArrayList();
        for (BusinessTypeEnum businessTypeEnum : BusinessTypeEnum.values()){
            Map map = new HashMap<>();
            map.put("code",businessTypeEnum.getCode());
            map.put("name",businessTypeEnum.getName());
            list.add(map);
        }
        return list;
    }

    public static List<BusinessTypeEnum> getBusinessTypeEnumList(Integer ...codes){
        List<BusinessTypeEnum> list = new ArrayList();
        for (BusinessTypeEnum businessTypeEnum : BusinessTypeEnum.values()){
            for(Integer code : codes){
                if(businessTypeEnum.getCode().equals(code)){
                    list.add(businessTypeEnum);
                }
            }
        }
        return list;
    }

    public static String getNameByCode(Integer code) {
        for (BusinessTypeEnum businessTypeEnum : BusinessTypeEnum.values()){
            if(businessTypeEnum.getCode().equals(code)){
                return businessTypeEnum.getName();
            }
        }
        return null;
    }
}
